package com.yaoyao.Trail_demo;

import java.util.Random;
import java.util.Scanner;


/*一个大V直播时发起了抢红包活动，分别有9，666，188，520，99999五个红包。请模拟粉丝来抽奖，按照先来先得，
* 随机抽取，抽完即止，注意：一个红包只能被抽一次，先抽和后抽拿一个红包是随机的*/
public class case5 {
    public static void main(String[] args) {
        int[] money = {9,666,188,520,99999};
        start(money);

    }
    public static  void start(int[] moneys){
        Random ra = new Random();
        int flag = 0;
        for (int i = 0; i < moneys.length; i++) {
            System.out.print("请按任意键完成抽奖：");
            Scanner sc = new Scanner(System.in);
            sc.next();
            while (true){
                int temp = ra.nextInt(0,moneys.length);
                if(moneys[temp] != flag){
                    System.out.println("恭喜您抽中了"+moneys[temp]);
                    moneys[temp] = flag;
                    break;
                }
            }
        }
        System.out.println("活动结束。。。");
    }
}
